
*libname TP_Data "The location of the data folder\TP_Pseudo";



/*Run this Macro to report Daniel, Grinblatt, Titman, and Wermers (1997) (DGTW) characteristic-adjusted mean returns and the Three- to Seven-factor model alphas*/

%MACRO DGTW_Ret_and_Alphas(Dataset=, DGTW_Ret_Var=, Ex_Ret_Var=);

Data Return_Data;
set &Dataset;
run;

proc means data= Return_Data mean stderr t prt ;
var  &DGTW_Ret_Var;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev;
run;

proc reg data= Return_Data plots=none;
model &Ex_Ret_Var =MKTRF SMB HML UMD PS_VWF ST_Rev LT_Rev;
run;

proc delete data= Return_Data ; run;

%mend DGTW_Ret_and_Alphas;




**** Online Appendix ****;



*** Table A2. Additional Descriptive Statistics ***;


Proc means data=TP_Data.Table_A2 mean ;
class TP;
var Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility dispersion Past_12m_return Relative_EPS_optimism  Investment_Bank_Affiliation  Target_Price_Rank_one Target_Price_Rank_two Target_Price_Rank_three Target_Price_Rank_four Target_Price_Rank_five ;
run;

Proc ttest data=TP_Data.Table_A2 plot=none;
class TP;
var Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility dispersion Past_12m_return Relative_EPS_optimism  Investment_Bank_Affiliation  Target_Price_Rank_one Target_Price_Rank_two Target_Price_Rank_three Target_Price_Rank_four Target_Price_Rank_five ;
run;





*** Table A3. Calendar-time portfolios: Buy Recommendations of Top Pick Analysts vs Other Analysts ***;


%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A3, DGTW_Ret_Var=Rec_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_Ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A3, DGTW_Ret_Var=Rec_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_Ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A3, DGTW_Ret_Var=ANA_IND_Rec_diff_DGTW_adj_ret, Ex_Ret_Var=ANA_IND_Rec_diff_ret)



*** Table A4: Calendar-Time Portfolios: Robustness ***;


** Panel A **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=Rec_SB_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_SB_Ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=TP_SB_Rec_diff_DGTW_adj_ret_ind, Ex_Ret_Var=TP_Rec_SB_diff_ret_ind)

** Panel B **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=Rec_SB_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_SB_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A4, DGTW_Ret_Var=TP_SB_Rec_diff_DGTW_adj_ret_ana, Ex_Ret_Var=TP_Rec_SB_diff_ret_ana)



*** Table A5: Calendar-time portfolios and Annual Sharpe Ratios ***;

Proc  report data=TP_Data.Table_A5 ;
column TP_Sharpe Rec_Ana_Sharpe Rec_Ind_Sharpe  ;
format TP_Sharpe 8.2 Rec_Ana_Sharpe 8.2 Rec_Ind_Sharpe 8.2;
run;



*** Table A6: Calendar-Time Portfolios: Alternative Portfolio Rebalancing Frequency ***;


** Panel A **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_A, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_A, DGTW_Ret_Var=Rec_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_A, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_Ana, Ex_Ret_Var=TP_Rec_diff_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_A, DGTW_Ret_Var=Rec_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_A, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_ind, Ex_Ret_Var=TP_Rec_diff_ret_ind)


** Panel B **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_B, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_B, DGTW_Ret_Var=Rec_DGTW_adj_ret_ana, Ex_Ret_Var=Rec_ex_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_B, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_Ana, Ex_Ret_Var=TP_Rec_diff_ret_ana)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_B, DGTW_Ret_Var=Rec_DGTW_adj_ret_ind, Ex_Ret_Var=Rec_ex_ret_ind)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A6_Panel_B, DGTW_Ret_Var=TP_Rec_diff_DGTW_Adj_ret_ind, Ex_Ret_Var=TP_Rec_diff_ret_ind)




*** Table A7: Calendar-Time Portfolios: Top Picks vs. Alternative Analyst Investment Strategies: Robustness ***;


** Panel A **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_1_DGTW_adj_ret, Ex_Ret_Var=Strategy_1_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_2_DGTW_adj_ret, Ex_Ret_Var=Strategy_2_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_3_DGTW_adj_ret, Ex_Ret_Var=Strategy_3_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_4_DGTW_adj_ret, Ex_Ret_Var=Strategy_4_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_5_DGTW_adj_ret, Ex_Ret_Var=Strategy_5_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_6_DGTW_adj_ret, Ex_Ret_Var=Strategy_6_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_A, DGTW_Ret_Var=Strategy_7_DGTW_adj_ret, Ex_Ret_Var=Strategy_7_Ex_ret)

** Panel B **;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_1_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_1_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_2_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_2_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_3_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_3_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_4_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_4_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_5_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_5_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_6_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_6_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A7_Panel_B, DGTW_Ret_Var=TP_Diff_Strategy_7_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_Strategy_7_Ex_ret)



*** Table A8: Calendar-Time Portfolios: Combination of Analyst Investment Strategy 1 and Analyst Investment Strategy 2 ***;

%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A8, DGTW_Ret_Var=TP_DGTW_adj_ret, Ex_Ret_Var=TP_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A8, DGTW_Ret_Var=St_1_and_2_DGTW_adj_ret, Ex_Ret_Var=St_1_and_2_Ex_ret)
%DGTW_Ret_and_Alphas(Dataset=TP_Data.Table_A8, DGTW_Ret_Var=TP_Diff_St_1_and_2_DGTW_adj_ret, Ex_Ret_Var=TP_Diff_St_1_and_2_ex_ret)



*** Table A9: Investment Value of Top Picks: Panel Regressions: Exclude [+1, +10] and [+1, +20] ***;


* Model 1 *;

Proc glm data=TP_Data.Table_A9_Model_1;
absorb Analyst_year_Dummy;
class YM_dummy Ind_Dummy;
model dgtw_adj_ret= 	TP  Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp Relative_EPS_optimism  drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						YM_dummy Ind_Dummy/ solution;
run;
quit;

* Model 2 *;

Proc glm data=TP_Data.Table_A9_Model_2;
absorb Analyst_year_Dummy;
class YM_dummy Ind_Dummy;
model dgtw_adj_ret= 	TP  Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp Relative_EPS_optimism  drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						YM_dummy Ind_Dummy/ solution;
run;
quit;


* Model 3 *;

Proc glm data=TP_Data.Table_A9_Model_3; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret= 	TP SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						YM_dummy / solution;
run;
quit;

* Model 4 *;

Proc glm data=TP_Data.Table_A9_Model_4; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret= 	TP SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						YM_dummy / solution;
run;
quit;




*** Table A10: Investment Value of Top Picks and Firm News Day ***;


Proc glm data=TP_Data.Table_A10; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP TP*firm_specific_news firm_specific_news SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
run;
quit;





*** Table A11: Investment Value of Top Picks vs Alternative Analyst Investment Strategies: Panel Regressions ***;


* Model 1 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_1 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_1' TP 1 Analyst_investment_strategy_1-1;
run;
quit;

* Model 2 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_2 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_2' TP 1 Analyst_investment_strategy_2-1;
run;
quit;


* Model 3 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_3 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_3' TP 1 Analyst_investment_strategy_3-1;
run;
quit;


* Model 4 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_4 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_4' TP 1 Analyst_investment_strategy_4-1;
run;
quit;


* Model 5 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_5 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_5' TP 1 Analyst_investment_strategy_5-1;
run;
quit;


* Model 6 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_6 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_6' TP 1 Analyst_investment_strategy_6-1;
run;
quit;


* Model 7 *;

Proc glm data=TP_Data.Table_A11; 
absorb Ind_year_Dummy;
class YM_dummy;
model dgtw_adj_ret=	TP Analyst_investment_strategy_7 SB Size BM Institutional_holding Turnover Dispersion Past_12m_return Analyst_Coverage fexp gexp Portsize Portfolio_complexity Relative_EPS_optimism All_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
					YM_dummy / solution;
					contrast 'TP = Analyst_investment_strategy_7' TP 1 Analyst_investment_strategy_7-1;

run;
quit;




*** Table A12: Institutional and Retail Investors� Trading Behavior of Top Picks: Alternative windows ***;


*** Panel A ***;


* Model 1 *;


PROC sort DATA=TP_Data.Table_A12_model_1 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_1 out=Table_A12_model_1_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_1_Std plots=none;
   model Pct_traded_imbalance_02_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_1_Std ; run;



* Model 2 *;


PROC sort DATA=TP_Data.Table_A12_model_2 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_2 out=Table_A12_model_2_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_2_Std plots=none;
   model Pct_traded_imbalance_02_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_2_Std ; run;



* Model 3 *;


PROC sort DATA=TP_Data.Table_A12_model_3 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_3 out=Table_A12_model_3_Ind_Year_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_3_Ind_Year_Std plots=none;
   model TP_Retail_Trade_Imb_02_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_3_Ind_Year_Std ; run;


* Model 4 *;


PROC sort DATA=TP_Data.Table_A12_model_4 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_4 out=Table_A12_model_4_Ana_Year_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_4_Ana_Year_Std plots=none;
   model TP_Retail_Trade_Imb_02_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_4_Ana_Year_Std ; run;




*** Panel B ***;


* Model 1 *;


PROC sort DATA=TP_Data.Table_A12_model_1 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_1 out=Table_A12_model_1_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_1_Std plots=none;
   model Pct_traded_imbalance_03_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_1_Std ; run;



* Model 2 *;


PROC sort DATA=TP_Data.Table_A12_model_2 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_2 out=Table_A12_model_2_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_2_Std plots=none;
   model Pct_traded_imbalance_03_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_2_Std ; run;



* Model 3 *;


PROC sort DATA=TP_Data.Table_A12_model_3 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_3 out=Table_A12_model_3_Ind_Year_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_3_Ind_Year_Std plots=none;
   model TP_Retail_Trade_Imb_03_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_3_Ind_Year_Std ; run;


* Model 4 *;


PROC sort DATA=TP_Data.Table_A12_model_4 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_4 out=Table_A12_model_4_Ana_Year_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_4_Ana_Year_Std plots=none;
   model TP_Retail_Trade_Imb_03_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_4_Ana_Year_Std ; run;




*** Panel C ***;


* Model 1 *;


PROC sort DATA=TP_Data.Table_A12_model_1 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_1 out=Table_A12_model_1_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_1_Std plots=none;
   model Pct_traded_imbalance_04_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_1_Std ; run;



* Model 2 *;


PROC sort DATA=TP_Data.Table_A12_model_2 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_2 out=Table_A12_model_2_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_2_Std plots=none;
   model Pct_traded_imbalance_04_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_2_Std ; run;



* Model 3 *;


PROC sort DATA=TP_Data.Table_A12_model_3 ;
by Ind_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_3 out=Table_A12_model_3_Ind_Year_Std mean=0;
by Ind_Year_Dummy;
RUN;

proc autoreg data=Table_A12_model_3_Ind_Year_Std plots=none;
   model TP_Retail_Trade_Imb_04_STD_adj=  TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_3_Ind_Year_Std ; run;


* Model 4 *;


PROC sort DATA=TP_Data.Table_A12_model_4 ;
by Analyst_year_Dummy;
RUN;

PROC standard DATA=TP_Data.Table_A12_model_4 out=Table_A12_model_4_Ana_Year_Std mean=0;
by Analyst_year_Dummy;
RUN;

proc autoreg data=Table_A12_model_4_Ana_Year_Std plots=none;
   model TP_Retail_Trade_Imb_04_STD_adj=  TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_A12_model_4_Ana_Year_Std ; run;








*** Table A13: Top Picks and Financial Market Attention: Institutional vs Retail Investors ***;


** Panel A **;


Proc means data=TP_Data.Table_A13_Panel_A_Row_1 mean t prt;
class TP;
var Mean_Bloomberg_Search_0_5 ;
run;

Proc ttest data=TP_Data.Table_A13_Panel_A_Row_1 plot=none;
class TP;
var Mean_Bloomberg_Search_0_5;
run;


Proc means data=TP_Data.Table_A13_Panel_A_Row_2 mean t prt;
class TP;
var Mean_GSVI_0_5;
run;

Proc ttest data=TP_Data.Table_A13_Panel_A_Row_2 plot=none;
class TP;
var Mean_GSVI_0_5;
run;


Proc means data=TP_Data.Table_A13_Panel_A_Row_3 mean t prt;
class TP;
var Mean_Abnormal_GSVI_0_5;
run;

Proc ttest data=TP_Data.Table_A13_Panel_A_Row_3 plot=none;
class TP;
var Mean_Abnormal_GSVI_0_5;
run;


** Panel B **;


Proc means data=TP_Data.Table_A13_Panel_B_Row_1 mean t prt;
class TP;
var Mean_Bloomberg_Search_0_5 ;
run;

Proc ttest data=TP_Data.Table_A13_Panel_B_Row_1 plot=none;
class TP;
var Mean_Bloomberg_Search_0_5;
run;


Proc means data=TP_Data.Table_A13_Panel_B_Row_2 mean t prt;
class TP;
var Mean_GSVI_0_5;
run;

Proc ttest data=TP_Data.Table_A13_Panel_B_Row_2 plot=none;
class TP;
var Mean_GSVI_0_5;
run;


Proc means data=TP_Data.Table_A13_Panel_B_Row_3 mean t prt;
class TP;
var Mean_Abnormal_GSVI_0_5;
run;

Proc ttest data=TP_Data.Table_A13_Panel_B_Row_3 plot=none;
class TP;
var Mean_Abnormal_GSVI_0_5;
run;


** Panel C **;


* Model 1* ;

Proc surveyreg data=TP_Data.Table_A13_Model_1;
class  Ind_year_Dummy;
cluster year_dummy;
model Mean_GSVI_0_5= 	TP SB Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp gexp portsize Portfolio_Complexity  Relative_EPS_optimism all_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						Ind_year_Dummy/ solution;
run;
quit;


* Model 2* ;

Proc surveyreg data=TP_Data.Table_A13_Model_2;
class  Ind_year_Dummy;
cluster year_dummy;
model Mean_Abnormal_GSVI_0_5=	TP SB Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp gexp portsize Portfolio_Complexity  Relative_EPS_optimism all_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
								Ind_year_Dummy/ solution;
run;
quit;


* Model 3* ;

Proc surveyreg data=TP_Data.Table_A13_Model_3;
class  Ind_year_Dummy;
cluster year_dummy;
model Mean_Bloomberg_Search_0_5= 	TP SB Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp gexp portsize Portfolio_Complexity  Relative_EPS_optimism all_star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
									Ind_year_Dummy/ solution;
run;
quit;


* Model 4* ;

Proc surveyreg data=TP_Data.Table_A13_Model_4;
class  Analyst_year_Dummy;
cluster year_dummy;
model Mean_GSVI_0_5= 	TP Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp    Relative_EPS_optimism  drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
						Analyst_year_Dummy/ solution;
run;
quit;


* Model 5* ;

Proc surveyreg data=TP_Data.Table_A13_Model_5;
class  Analyst_year_Dummy;
cluster year_dummy;
model Mean_Abnormal_GSVI_0_5= 	TP Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp   Relative_EPS_optimism drop_cov  Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
								Analyst_year_Dummy/ solution;
run;
quit;


* Model 6* ;

Proc surveyreg data=TP_Data.Table_A13_Model_6;
class  Analyst_year_Dummy;
cluster year_dummy;
model Mean_Bloomberg_Search_0_5=	TP Size BM Institutional_holding Turnover Analyst_Coverage Idiosyncratic_Volatility Dispersion Past_12m_return  fexp   Relative_EPS_optimism drop_cov  Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec
									Analyst_year_Dummy/ solution;
run;
quit;

